package org.jground.rx.def.apps.core;
import org.jground.rx.*;
import org.jground.rx.gen.*;
import org.jground.util.*;
import java.util.List;
import org.jground.rx.def.apps.accounting.*;
import org.jground.rx.def.apps.commons.*;
import org.jground.rx.def.apps.knowledge.*;
import org.jground.rx.def.*;
import org.jground.rx.def.apps.crm.*;
import org.jground.rx.def.apps.cip.*;
import org.jground.rx.def.apps.legal.*;
import org.jground.rx.def.apps.ipm.*;
@SuppressWarnings("unused")
public class Person extends GenRoot {

    public static final String moid = "org.jground.rx.def.apps.core.Person";

    private static final String gender ="gender";
    private static final String name ="name";
    private static final String middleName ="middleName";
    private static final String secondaryName ="secondaryName";
    private static final String job ="job";
    private static final String startDate ="startDate";
    private static final String endDate ="endDate";
    private static final String legalCountry ="legalCountry";
    private static final String mainAddress ="mainAddress";
    private static final String addresses ="addresses";
    private static final String documents ="documents";
    private static final String $CREATOR ="$CREATOR";

    public static final class AttName {
        public static final String gender ="gender";
        public static final String name ="name";
        public static final String middleName ="middleName";
        public static final String secondaryName ="secondaryName";
        public static final String job ="job";
        public static final String startDate ="startDate";
        public static final String endDate ="endDate";
        public static final String legalCountry ="legalCountry";
        public static final String mainAddress ="mainAddress";
        public static final String addresses ="addresses";
        public static final String documents ="documents";
        public static final String $CREATOR ="$CREATOR";
    }

    public static Person createNew() { return new Person(RXObjectService.getInstance().create(moid)); }

    public static Person getById(String oid) { 
        IRXObject mod = RXObjectService.getInstance().getById(oid);
        if(mod == null) { return null; }
        return new Person(mod);
    }

    public static Person[] getByIds(String... oids) { 
        List<IRXObject> mods = RXObjectService.getInstance().getByIds(moid, oids);
        Person[] res = new Person[mods.size()];
        int i = 0;
        for(IRXObject mod : mods) {
            res[i] = new Person(mod);
            i++;
        }
        return res;
    }

    public static SearchCriteria newSearchCriteria() {
        return  SearchCriteria.create(moid);
    }

    public static Person[] search(SearchCriteria sc) {
        return  wrap(GenRoot._search(sc));
    }

    public static Person[] wrap(List<? extends IRXObjectSynopsis> mods) { 
        Person[] res = new Person[mods.size()];
        int i = 0;
        for(IRXObjectSynopsis mod : mods) {
            res[i] = new Person(mod);
            i++;
        }
        return res;
    }

    public static Person wrap(IRXObjectSynopsis mod) { 
        return new Person(mod);
    }

    private Person(IRXObjectSynopsis rxObject) {this.rxObject = (IRXObject) rxObject;}

    public static String getGenderLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, gender).getLabel();
    }

    public static String getGenderDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, gender).getDescription();
    }

    public void setGender(String codeValue) {
        rxObject.set(gender, _to_String(codeValue));
    }

    public String getGender() {
        return _to_String(rxObject.getCurrentValue(gender));
    }

    public static String getNameLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, name).getLabel();
    }

    public static String getNameDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, name).getDescription();
    }

    public void setName(String string) {
        rxObject.set(name, _to_String(string));
    }

    public String getName() {
        return _to_String(rxObject.getCurrentValue(name));
    }

    public static String getMiddleNameLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, middleName).getLabel();
    }

    public static String getMiddleNameDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, middleName).getDescription();
    }

    public void setMiddleName(String string) {
        rxObject.set(middleName, _to_String(string));
    }

    public String getMiddleName() {
        return _to_String(rxObject.getCurrentValue(middleName));
    }

    public static String getSecondaryNameLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, secondaryName).getLabel();
    }

    public static String getSecondaryNameDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, secondaryName).getDescription();
    }

    public void setSecondaryName(String string) {
        rxObject.set(secondaryName, _to_String(string));
    }

    public String getSecondaryName() {
        return _to_String(rxObject.getCurrentValue(secondaryName));
    }

    public static String getJobLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, job).getLabel();
    }

    public static String getJobDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, job).getDescription();
    }

    public org.jground.rx.def.apps.core.Job getJob() {
        return ArrayUtils.first(org.jground.rx.def.apps.core.Job.wrap(rxObject.getComponents(AttName.job)));
    }

    public org.jground.rx.def.apps.core.Job createJob() {
        return org.jground.rx.def.apps.core.Job.wrap(rxObject.newComponent(job));
    }

    public void setJob(org.jground.rx.def.apps.core.Job value) {
        rxObject.set(job, value.getOidString());
    }

    public static String getStartDateLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, startDate).getLabel();
    }

    public static String getStartDateDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, startDate).getDescription();
    }

    public void setStartDate(String dateValue) {
        rxObject.set(startDate, _to_String(dateValue));
    }

    public String getStartDate() {
        return _to_String(rxObject.getCurrentValue(startDate));
    }

    public static String getEndDateLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, endDate).getLabel();
    }

    public static String getEndDateDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, endDate).getDescription();
    }

    public void setEndDate(String dateValue) {
        rxObject.set(endDate, _to_String(dateValue));
    }

    public String getEndDate() {
        return _to_String(rxObject.getCurrentValue(endDate));
    }

    public static String getLegalCountryLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, legalCountry).getLabel();
    }

    public static String getLegalCountryDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, legalCountry).getDescription();
    }

    public void setLegalCountry(String codeValue) {
        rxObject.set(legalCountry, _to_String(codeValue));
    }

    public String getLegalCountry() {
        return _to_String(rxObject.getCurrentValue(legalCountry));
    }

    public static String getMainAddressLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, mainAddress).getLabel();
    }

    public static String getMainAddressDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, mainAddress).getDescription();
    }

    public org.jground.rx.def.apps.core.Address getMainAddress() {
        return ArrayUtils.first(org.jground.rx.def.apps.core.Address.wrap(rxObject.getComponents(AttName.mainAddress)));
    }

    public org.jground.rx.def.apps.core.Address createMainAddress() {
        return org.jground.rx.def.apps.core.Address.wrap(rxObject.newComponent(mainAddress));
    }

    public void setMainAddress(org.jground.rx.def.apps.core.Address value) {
        rxObject.set(mainAddress, value.getOidString());
    }

    public static String getAddressesLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, addresses).getLabel();
    }

    public static String getAddressesDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, addresses).getDescription();
    }

    public int getAddressesSize() {
        return org.jground.rx.def.apps.core.Address.wrap(rxObject.getComponents(AttName.addresses)).length;
    }

    public org.jground.rx.def.apps.core.Address[] getAddresses() {
        return org.jground.rx.def.apps.core.Address.wrap(rxObject.getComponents(AttName.addresses));
    }

    public org.jground.rx.def.apps.core.Address getAddresses(int index) {
        return org.jground.rx.def.apps.core.Address.wrap(rxObject.getComponents(AttName.addresses))[index];
    }

    public org.jground.rx.def.apps.core.Address createAddresses() {
        return org.jground.rx.def.apps.core.Address.wrap(rxObject.newComponent(addresses));
    }

    public void setAddresses(org.jground.rx.def.apps.core.Address[] values) {
        rxObject.set(addresses, _to_String(addresses));
    }

    public void addAddresses(org.jground.rx.def.apps.core.Address value) {
        rxObject.add(addresses, value.getOidString());
    }

    public static String getDocumentsLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, documents).getLabel();
    }

    public static String getDocumentsDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, documents).getDescription();
    }

    public int getDocumentsSize() {
        return org.jground.rx.def.apps.commons.Document.wrap(rxObject.getComponents(AttName.documents)).length;
    }

    public org.jground.rx.def.apps.commons.Document[] getDocuments() {
        return org.jground.rx.def.apps.commons.Document.wrap(rxObject.getComponents(AttName.documents));
    }

    public org.jground.rx.def.apps.commons.Document getDocuments(int index) {
        return org.jground.rx.def.apps.commons.Document.wrap(rxObject.getComponents(AttName.documents))[index];
    }

    public org.jground.rx.def.apps.commons.Document createDocuments() {
        return org.jground.rx.def.apps.commons.Document.wrap(rxObject.newComponent(documents));
    }

    public void setDocuments(org.jground.rx.def.apps.commons.Document[] values) {
        rxObject.set(documents, _to_String(documents));
    }

    public void addDocuments(org.jground.rx.def.apps.commons.Document value) {
        rxObject.add(documents, value.getOidString());
    }

    public static String get$CREATORLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, $CREATOR).getLabel();
    }

    public static String get$CREATORDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, $CREATOR).getDescription();
    }

    public void set$CREATOR(String string) {
        rxObject.set($CREATOR, _to_String(string));
    }

    public String get$CREATOR() {
        return _to_String(rxObject.getCurrentValue($CREATOR));
    }

}
